package com.yuerenjf.yuerenjinfu.utils;

import android.graphics.Bitmap;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.yuerenjf.yuerenjinfu.R;

/**
 * Created by Administrator on 2017/6/6 0006.
 */

public class MyDisplayImageOptions {

    private static DisplayImageOptions options;

    private MyDisplayImageOptions(){

    }
    public static DisplayImageOptions getInstance(){
        if(options==null){
            options = new DisplayImageOptions.Builder()
                    .cacheInMemory(true)
                    .cacheOnDisk(true)
                    .showImageOnLoading(R.drawable.icon_userauthentication_card_bg)
                    .showImageOnFail(R.drawable.icon_userauthentication_card_bg)
                    .bitmapConfig(Bitmap.Config.RGB_565)
                    .build();
            return options;
        }else{
            return options;
        }
    }

    public static DisplayImageOptions getInstance(int resource){
        DisplayImageOptions  options = new DisplayImageOptions.Builder()
                    .cacheInMemory(true)
                    .cacheOnDisk(true)
                    .showImageOnLoading(resource)
                    .showImageOnFail(resource)
                    .bitmapConfig(Bitmap.Config.RGB_565)
                    .build();
            return options;
    }

}
